Skip to content

Instantly share code, notes, and snippets.

View CharlesSOo's full-sized avatar
🌴
On vacation

Charles So CharlesSOo

🌴
On vacation
View GitHub Profile
@heyalexej
heyalexej / unique-permutations.py
Created July 2, 2014 18:11
create all unique permutations of a word. please comment if you know of more efficient ways to do it.
#!/usr/bin/env python2
import sys
from itertools import permutations
str1 = sys.argv[1]
str2 = int(len(str1))
def uniques(iterable, r=None):
'''weird behavior in itertools permutations.
@egel
egel / auto-remove-sublime-license-popup
Last active July 27, 2025 03:55
Auto-remove Sublime's license popup
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sublime_plugin
import subprocess
from time import sleep
import sys
cl = lambda line: subprocess.Popen(line, shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
log = lambda message: sys.stderr.write("Log: %s\n" % message)
documentcreatetextnode
telecommunications
sublimedirectory
responsibilities
characterization
troubleshooting
representatives
representations
recommendations
pharmaceuticals
<html><head><link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"></head><body><div class="table-responsive"><table class="table">
<tr><th>Ratio</th><th>Combos</th></tr>
<tr><td align="center">8.23</td><td align="center" bgcolor="#542437"><font color="#ECD078"><h2>#ECD078 looks good on #542437</h2></font></td></tr>
<tr><td align="center">8.23</td><td align="center" bgcolor="#ECD078"><font color="#542437"><h2>#542437 looks good on #ECD078</h2></font></td></tr>
<tr><td align="center">4.92</td><td align="center" bgcolor="#C7F464"><font color="#556270"><h2>#556270 looks good on #C7F464</h2></font></td></tr>
<tr><td align="center">4.92</td><td align="center" bgcolor="#556270"><font color="#C7F464"><h2>#C7F464 looks good on #556270</h2></font></td></tr>
<tr><td align="center">4.99</td><td align="center" bgcolor="#F1D4AF"><font color="#774F38"><h2>#774F38 looks good on #F1D4AF</h2></font></td></tr>
<tr><td align="center">5.63</td><td align="center" bgcolor="#
@heyalexej
heyalexej / gsm-setup.md
Last active August 20, 2025 21:09
SIM Card Management Through GSM Modem On Linux

SIM Card Management Over GSM Modem

A small guide on how to send and receive USSD codes on Linux

I am using the built in GSM (UMTS) modem of my Thinkpad X1 extensively because I am often in places with flaky internet connections. I connect through the standard Network Manager on Ubuntu and everything works fine. There was one major annoyance though. Every time I wanted to top up the SIM balance or book a new package, I needed a phone to send and receive USSD codes. So I took some time to figure out how to do it from the shell. I wrote this down as a help for others and a reminder for myself. Without further ado...

First intsall gammu and picocom.

~  sudo apt-get install -y gammu picocom
@prakhar1989
prakhar1989 / richhickey.md
Last active January 30, 2025 06:39 — forked from stijlist/gist:bb932fb93e22fe6260b2
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@stvhwrd
stvhwrd / website-dl.md
Last active July 2, 2025 22:31
Download an entire website for offline use with wget. Internal inks will be corrected so that the entire downloaded site will work as it did online.

The best way to download a website for offline use, using wget

There are two ways - the first way is just one command run plainly in front of you; the second one runs in the background and in a different instance so you can get out of your ssh session and it will continue.

First make a folder to download the websites to and begin your downloading: (note if downloading www.SOME_WEBSITE.com, you will get a folder like this: /websitedl/www.SOME_WEBSITE.com/)


STEP 1:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
""" fuzzing accessible urls.
>>> import random, string
>>> ld = string.letters+string.digits
>>> ld
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
>>> len(ld)
62
@bnagy
bnagy / gpgmutt.md
Last active July 21, 2025 11:06
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
jQuery(document).ready(function() {
var originalTitle = document.getElementsByTagName("title")[0].innerHTML;
jQuery(window).on("blur", function() {
timerId = setTimeout(function() {
document.getElementsByTagName("title")[0].innerHTML = "(1) " + originalTitle;
}
, 2000);
}
);
jQuery(window).on("focus", function() {