Skip to content

Instantly share code, notes, and snippets.

View nim4n136's full-sized avatar
๐Ÿ 
Working from home

NIM4N nim4n136

๐Ÿ 
Working from home
View GitHub Profile
@nim4n136
nim4n136 / MainActivity.java
Created March 19, 2021 08:34 — forked from rduplain/MainActivity.java
A very simple full-screen WebView activity for Android native wrappers, as a starting point.
package com.willowtreeapps.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
#!/bin/bash
ARCHIVEDIR='/var/lib/pgsql/wal_archive'
LAST_BACKUP=$(ls -lto ${ARCHIVEDIR})
FILE_LIST=$(pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}")
## TEST FIRST
pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}" | find -type f -mmin +30 | xargs ls -lh
@nim4n136
nim4n136 / auth.py
Created March 3, 2020 11:10 — forked from ibeex/auth.py
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%[email protected]' % username
@nim4n136
nim4n136 / init.md
Created June 24, 2019 10:39 — forked from seankross/init.md
Initializing GitHub repository

Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/seankross/womp.git
git push -u origin master
@nim4n136
nim4n136 / Sync gh-pages + master branches
Created December 11, 2018 15:08 — forked from mandiwise/Sync gh-pages + master branches
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
@nim4n136
nim4n136 / async-await.js
Created November 27, 2018 16:07 — forked from wesbos/async-await.js
Simple Async/Await Example
// ๐Ÿ”ฅ Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('โ˜•'), 2000); // it takes 2 seconds to make coffee
});
}