Skip to content

Instantly share code, notes, and snippets.

View itsamirhn's full-sized avatar
πŸ¦‰
Work & Study

Amir Hosseini itsamirhn

πŸ¦‰
Work & Study
  • Divar
  • Tehran - IRAN
View GitHub Profile
extension String {
private func regionalIndicatorSymbol(unicodeScalar: UnicodeScalar) -> UnicodeScalar? {
let uppercaseA = UnicodeScalar("A")!
let regionalIndicatorSymbolA = UnicodeScalar("\u{1f1e6}")!
let distance = unicodeScalar.value - uppercaseA.value
return UnicodeScalar(regionalIndicatorSymbolA.value + distance)
}
public var emojiFlag: String {
return self.uppercased().unicodeScalars.map({
@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@saggie
saggie / Dockerfile
Created February 16, 2017 06:26
Simple SSH daemon container allowing root login with empty password.
FROM ubuntu:16.04
# Install sshd
RUN apt-get update
RUN apt-get install -y openssh-server
# Modify `sshd_config`
RUN sed -ri 's/PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config
RUN sed -ri 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/^UsePAM yes/UsePAM no/' /etc/ssh/sshd_config
@bwann
bwann / README.md
Last active December 10, 2024 03:56
Tunnelling SSH over SSL/TLS

How to tunnel SSH over SSL/TLS

laptop ssh -> laptop stunnel -> evil network -> internet -> your server -> your server ssh

Server (your shell server/home box/work box/whatever)

Sets up a stunnel process listening externally on port 2443/tcp, forwards to localhost 22/tcp

  • Install stunnel, e.g. yum install stunnel
  • Install server config snippet to /etc/stunnel/stunnel.conf
@o-morenets
o-morenets / itof.java
Created November 8, 2016 19:52
Infix to Postfix conversion using java .
import java.util.*;
public class itof{
private static final char ADD = '+', SUBTRACT = '-';
private static final char MULTIPLY = '*', DIVIDE = '/';
private static final char POWER ='^';
public itof(){
}
@michaellihs
michaellihs / tmux-cheat-sheet.md
Last active April 23, 2025 18:28
tmux Cheat Sheet
@dorelljames
dorelljames / letsencrypt-guide-nginx-acme.sh.md
Last active November 13, 2024 22:47
SSL via Let's Encrypt (nginx server)

Nginx SSL via Let's Encrypt and acme.sh

This guide is intended to walk you through installation of a valid SSL on your server for your site at example.com. This example is using root user, you may need to use sudo if you encounter problems such as write permissions.

Pre-requisites

  • Install acme.sh on your server. This will create a acme.sh folder in your home directory and more importantly create an everyday cron job to check and renew certificates if needed.
  • Install nginx server (different per distibution so just make sure you have it up and running)
@ar-pa
ar-pa / BigInt.cpp
Last active March 24, 2025 01:15
bignum class for C++
// In the name of Allah.
// We're nothing and you're everything.
// Ya Ali!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e2 + 14, lg = 15;
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 29, 2025 18:03
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@rxaviers
rxaviers / gist:7360908
Last active April 29, 2025 17:19
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue: