Skip to content

Instantly share code, notes, and snippets.

View mortymacs's full-sized avatar

Morteza NourelahiAlamdari mortymacs

View GitHub Profile
@llonchj
llonchj / main.go
Created October 17, 2018 21:46
Proof of concept
package main
import (
"fmt"
"net/http"
"github.com/gocolly/colly"
)
type MyCollector struct {
@baiwfg2
baiwfg2 / CMakeLists.txt
Created September 29, 2018 12:42
How to use add_custom_target and add_custom_command correctly in cmake
# References:
# https://cmake.org/cmake/help/latest/command/add_custom_target.html
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
# https://gist.github.com/socantre/7ee63133a0a3a08f3990
# https://stackoverflow.com/questions/24163778/how-to-add-custom-target-that-depends-on-make-install
# https://stackoverflow.com/questions/30719275/add-custom-command-is-not-generating-a-target
# https://stackoverflow.com/questions/26024235/how-to-call-a-cmake-function-from-add-custom-target-command
# https://blog.csdn.net/gubenpeiyuan/article/details/51096777
cmake_minimum_required(VERSION 3.10)
@RatoX
RatoX / tmux.conf
Created September 13, 2018 02:39
Integrate TMUX with Google Calendar using gcalcli
# First you need to install gcalcli please go to https://github.com/insanum/gcalcli
wg_next_event="#(gcalcli --military --nostarted agenda --nocolor | cut -d ' ' -f 2- | head -2 | tail -1 | cut -c1-40)"
set -g status-right "#[fg=colour15,bg=colour237,bold]📅 $wg_next_event"
@ggsalas
ggsalas / kitty.conf
Last active January 10, 2023 18:34
Kitty terminal - one dark theme [~/.config/kitty/kitty.conf]
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
# font_family Monaco
font_family Source Code Pro
@namannik
namannik / HtmlEditor.py
Last active May 14, 2022 16:42
PyGTK HTML WYSIWYG Editor
import os
import gi
gi.require_version("Gtk", "3.0")
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk, Gdk, WebKit2
class HtmlEditor(Gtk.Window):
def __init__(self):
super().__init__()
@pastleo
pastleo / nm_l2tp_ipsec_vpn.md
Last active February 14, 2025 08:44
setup L2TP IPSEC VPN in archlinux using NetworkManager
@mortymacs
mortymacs / result of run
Last active February 5, 2018 20:30
Thread-Specific State in Python
[morteza@ipo ~]$ python sample.py
Traceback (most recent call last):
File "sample.py", line 29, in <module>
print(s[2].p())
File "sample.py", line 11, in p
print(self.local.name)
AttributeError: '_thread._local' object has no attribute 'name'
[morteza@ipo ~]$ python sample.py
Traceback (most recent call last):
File "sample.py", line 29, in <module>
@mortymacs
mortymacs / change-author-of-last-commits.md
Last active January 28, 2023 19:30
How to change author of last commits

First find your commit:

$ git log

Then copy the last commit ID (one commit after your target commit. it means your target commit + 1).

Then start rebase:

$ git rebase -i 234234rfsdfrq3213412e412
@mortymacs
mortymacs / My-vim-config-vimrc
Last active February 25, 2018 08:50
My vim config
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@mortymacs
mortymacs / base-actor-model.py
Last active January 10, 2018 05:33
Simple Actor Model in Python
import time
import threading
from queue import Queue, Empty
class Actor(object):
"""Basic event-based actor abstract."""
def __init__(self):
"""Initialize Actor class."""
self.inbox = Queue()