Skip to content

Instantly share code, notes, and snippets.

@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@gingerlime
gingerlime / change_db_owner.sh
Created April 24, 2012 19:32
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@matteomattei
matteomattei / crc32.py
Created July 8, 2014 07:52
Calculate CRC32 of a file in Python
#!/usr/bin/env python
import binascii
def CRC32_from_file(filename):
buf = open(filename,'rb').read()
buf = (binascii.crc32(buf) & 0xFFFFFFFF)
return "%08X" % buf
@Rob--W
Rob--W / escaopeHTMLTag.js
Created November 14, 2016 16:39
Example of safe HTML escaping using template literals
/* Example:
var someUnsafeStr = '<img>';
var result = escapeHTMLTag`<input value="${someUnsafeStr}">`;
console.log(result); // <input value="&lt;img&gt;">
// Questions? rob {at} robwu.nl
// */
function escapeHTML(str) {
// Note: string cast using String; may throw if `str` is non-serializable, e.g. a Symbol.
@meain
meain / loading_messages.js
Last active July 22, 2024 13:32
Funny loading messages
export default [
"Reticulating splines...",
"Generating witty dialog...",
"Swapping time and space...",
"Spinning violently around the y-axis...",
"Tokenizing real life...",
"Bending the spoon...",
"Filtering morale...",
"Don't think of purple hippos...",
"We need a new fuse...",
@fnky
fnky / ANSI.md
Last active July 25, 2024 15:42
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@codesorter2015
codesorter2015 / reloadpage.txt
Last active March 9, 2022 12:24
reload the page using javascript
location = location
... and a 534 other ways to reload the page with JavaScript
location = location
location = location.href
location = window.location
location = self.location
location = window.location.href
location = self.location.href
location = location['href']
location = window['location']
@m-Phoenix852
m-Phoenix852 / discord-token-logger.js
Created August 26, 2020 07:45
Simple script to log in to discord account using token.
let token = "your token";
function login(token) {
setInterval(() => {
document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token = `"${token}"`
}, 50);
setTimeout(() => {
location.reload();
}, 2500);
}
@wh0th3h3llam1
wh0th3h3llam1 / colorful_output.bat
Created October 15, 2021 13:36
Colorful output on Python/Bash/Batch/PowerShell
@echo off
echo Gray
echo Red
echo Green
echo Yellow
echo Blue
echo Magenta
echo Cyan
echo White
@tnhung2011
tnhung2011 / forkbomb.c
Last active August 29, 2022 02:27
A list of fork bombs that could destroy both Linux and Macs
#include <unistd.h>
int main() {
while(1) fork();
return 0;
}