This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get current status of a OpenFortiVPN connection with options to connect/disconnect. | |
# Commands that require admin permissions should be whitelisted with 'visudo', e.g.: | |
# YOURUSERNAME ALL=(ALL) NOPASSWD: /usr/local/bin/openfortivpn | |
# YOURUSERNAME ALL=(ALL) NOPASSWD: /usr/bin/killall -2 openfortivpn | |
# To use openfortivpn in an easy way you can create file like: /Documents/.fortivpn-config and put your crential in it as following: | |
# | |
# host=123.45.678.9 | |
# port=1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First of all you need install *libraqm* on your machin. | |
# The Raqm library encapsulates the logic for complex text layouts and provides a convenient API. | |
# libraqm relies on the following libraries: FreeType, HarfBuzz, FriBiDi, | |
# make sure that you install them before installing libraqm if not available as package in your system. | |
# if you using macos you can install libraqm with homebrew | |
# $> brew install libraqm | |
# Pillow wheels since version 8.2.0 include a modified version of libraqm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew list | |
==> Formulae | |
ali gnu-sed libogg mitmproxy recode | |
aom gnupg libpng mpdecimal rtmpdump | |
apr gnutls libpq mpfr rubberband | |
apr-util go libpthread-stubs mpv ruby | |
argon2 gobject-introspection librist msgpack sdl2 | |
asdf graphite2 librsvg mujs sheldon | |
aspell graphviz libsamplerate mutagen six | |
autoconf grep libsndfile ncurses snappy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Queue<T> { | |
private list: T[] = []; | |
private readonly capacity: number | null = null; | |
private tail = 0; | |
private head = 0; | |
constructor(capacity: number) { | |
this.capacity = Math.max(capacity, 0) || null; | |
if (this.capacity) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ngram_string(string, n=3, remove_space=False): | |
if remove_space: | |
string = string.replace(' ', '') | |
if len(string) < n: | |
return {string: 1} | |
ngrams = dict() | |
for i in range(len(string)-n+1): | |
ngram = string[i:i+n] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
function randomInt(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
function randomIDGenerator(length) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
from django.db import models | |
# Use the import below instead, if using GeoDjango fields | |
# from django.contrib.gis.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
from django.contrib.postgres.fields import ( | |
ArrayField, | |
CICharField, | |
CIEmailField, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Forked from: https://coderwall.com/p/fyfp0w/applescript-to-connect-bluetooth-headphones | |
activate application "SystemUIServer" | |
tell application "System Events" | |
tell process "SystemUIServer" | |
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth") | |
tell btMenu | |
click | |
tell (menu item "PUT_YOUR_AIRPODE_NAME_HERE" of menu 1) -- Touhid’s AirPods not Touhid's AirPods | |
click | |
if exists menu item "Connect" of menu 1 then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo certbot certonly --standalone -d registry.example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Open https://app.snapp.ir | |
* Login with your credentials | |
* Copy and pasting this code in developer tools console | |
* Waiting... :) | |
*/ | |
(async function () { | |
function sleep(ms = 0) { | |
return new Promise(r => setTimeout(r, ms)); | |
} |
NewerOlder