Skip to content

Instantly share code, notes, and snippets.

View saman's full-sized avatar

Saman Soltani saman

View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
import ssl
import socket
import os
import sys
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
from threading import Thread
@JoshCheek
JoshCheek / uninstall_snap_camera_mac_osx.sh
Last active October 31, 2023 23:36
How to uninstall Snap Camera on Mac OS X
# these are reconstructed from a shell session without runnig them, so make
# sure you check that it's a sane thing to do before running it, I make no
# guarantees of fitness, and accept no liability. Run at your own risk.
sudo launchctl remove com.snap.SnapCameraRemover
rm -r ~/Library/Caches/Snap/
rm -r ~/Library/Caches/com.snap.SnapCamera/
rm -r ~/Library/Preferences/Snap/
rm ~/Library/Preferences/com.snap.SnapCamera.plist
rm ~/Library/Preferences/com.snap.Snap\ Camera.plist
sudo rm -rf /Applications/Snap\ Camera.app/
function Mutilator(data, name, context) {
this.n = name || `mutilation-${+new Date()}`;
this.d = data;
this.c = context || window;
this.isArr = function(p) {
return this.d[p].constructor == Array;
};
this.dispatch = function(p, v, t) {
this.c.dispatchEvent(
new CustomEvent(this.n, {
@itshaadi
itshaadi / subfixer.sh
Last active March 27, 2021 11:58
this script will change the encoding from whatever to UTF-8
#!/bin/bash
#you may need to install uchardet package first. sudo apt install uchardet
# https://github.com/BYVoid/uchardet
#replace underscore with white-space !important (iconv cannot find files with white-space in their name)
find -name "* *.srt" -type f | rename 's/ /_/g'
for sub in *.srt;
do
encode="$(uchardet "${sub}")"
@hallaji
hallaji / README.markdown
Last active August 9, 2017 02:49
Iranian National Identifier Validator

Iranian National Identifier Validator

A validator for Iranian (Persian) national identifier or social number

Languages

c#, java, javascript, php

Types

parameter: string (It doesn't support arabic or persian numbers)
return: boolean

@tedmiston
tedmiston / nodejs-tcp-example.js
Last active May 20, 2024 11:27
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@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'},