Skip to content

Instantly share code, notes, and snippets.

View sengkyaut's full-sized avatar
🐶
Working from home

Seng Kyaut sengkyaut

🐶
Working from home
View GitHub Profile
@sengkyaut
sengkyaut / replace.sh
Created January 6, 2022 17:31 — forked from hlissner/replace.sh
Bulk search & replace with ag (the_silver_searcher)
# ag <https://github.com/ggreer/the_silver_searcher>
# usage: ag-replace.sh [search] [replace]
# caveats: will choke if either arguments contain a forward slash
# notes: will back up changed files to *.bak files
ag -0 -l $1 | xargs -0 perl -pi.bak -e "s/$1/$2/g"
# or if you prefer sed's regex syntax:
ag -0 -l $1 | xargs -0 sed -ri.bak -e "s/$1/$2/g"
@sengkyaut
sengkyaut / interact_sort.py
Last active December 31, 2021 17:43
python Interactive Sorting
# SK
# Interactive Sorting
def merge(arr, l, m, r):
n1 = m - l + 1
n2 = r - m
# create temp arrays
L = [0] * (n1)
R = [0] * (n2)
@sengkyaut
sengkyaut / revert-a-commit.md
Created December 15, 2021 14:56 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

# REQUIRED CONFIG
BOT_TOKEN = "2010034113:AAEqUxzi__dS6lcT5EX3dHSd4OIEuVLUHJc"
GDRIVE_FOLDER_ID = "0AHpxhypbUswoUk9PVA"
OWNER_ID = 1086851583
DOWNLOAD_DIR = "./downloads"
DOWNLOAD_STATUS_UPDATE_INTERVAL = 5
AUTO_DELETE_MESSAGE_DURATION = 20
IS_TEAM_DRIVE = "True"
TELEGRAM_API = 6878280
TELEGRAM_HASH = "e0b90ef2bcda7c3a8c88bc69cfc72b78"
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@sengkyaut
sengkyaut / gist:3fcdba9600dedeab9ed548a6d93e4e20
Created July 28, 2021 17:38 — forked from pwlin/gist:8a0d01e6428b7a96e2eb
Android : add cert to system store
https://code.google.com/p/android/issues/detail?id=32696#c5
If you have a certificate that is not
trusted by Android, when you add it, it goes in the personal cert store.
When you add a cert in this personal cert store, the system requires a
higher security level to unlock the device. But if you manage to add your
cert to the system store then you don't have this requirement. Obviously,
root is required to add a certificate to the system store, but it is quiet
easy.
@sengkyaut
sengkyaut / user.js
Created February 21, 2021 06:44 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
..;/
@
_
0
00
01
02
03
04
05
@sengkyaut
sengkyaut / route.php
Created July 12, 2020 16:56 — forked from NabiKAZ/route.php
For show advanced list of files and directories with sort, date, size, icon type,..., Save bellow content code as `route.php` file, and then run this command: `php -S localhost:8080 -t . route.php` And then open `http://localhost:8080/` in the browser.
<?php
//@NabiKAZ
//For show advanced list of files and directories with sort, date, size, icon type,...,
//Save bellow content code as route.php file, and then run this command:
// php -S localhost:8080 -t . route.php
//And then open http://localhost:8080/ in the browser.
//////////////////////////////////////////////////////////////////
// This block MUST be at the very top of the page!
@ob_start('ob_gzhandler');
if(isset($_GET['icon']))
@sengkyaut
sengkyaut / all.txt
Created July 3, 2020 06:11 — forked from jhaddix/all.txt
all wordlists from every dns enumeration tool... ever. Please excuse the lewd entries =/
This file has been truncated, but you can view the full file.
.
..
........
@
*
*.*
*.*.*
🐎
0