Skip to content

Instantly share code, notes, and snippets.

@eamirgh
eamirgh / gist:650f86393b1826dd5c5e5fc68dd5f06e
Last active June 5, 2024 18:51
RESET Goland Evaluation period LINUX
rm -rf ~/.config/JetBrains/GoLand2021.3/eval
rm -rf ~/.config/JetBrains/GoLand2021.3/options/other.xml
touch ~/.config/JetBrains/GoLand2021.3/options/other.xml
sed -i -E 's/<property name=\"evl.*\".*\/>//' ~/.config/JetBrains/GoLand2021.3/options/other.xml
rm -rf ~/.java/.userPrefs/jetbrains/goland
@userid
userid / netlink1.c
Last active January 8, 2025 00:32
使用rtnetlink监听和判断网卡的状态变化
/**
http://guochongxin.github.io/c/c/c++/linux/netlink/rj45/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/%E7%BD%91%E5%8D%A1/2014/12/05/tong_guo_netlink_jian_ce_wang_xian_cha_ba
最近有个需求需要检测RJ45网卡的网线有没有接上而最近正在了解Netlink相关资料刚好也看下通过Netlink可以进行检测故在此做下粗略笔记
1.首先要创建一个Netlink Socket在用户层使用如下参数来调用socket()函数
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
@petemoore
petemoore / main_windows.go
Last active August 8, 2024 15:32
Running process as interactive user from windows service with UAC process elevation
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
"os/exec"
"syscall"
@kaiwan
kaiwan / errno_codes.txt
Created June 2, 2018 06:53
Linux errno values
errno.h - C Error Codes in Linux
All the Linux/C error codes are listed below.
I occasionally google C error codes, but always end up grepping through /usr/include to find the answer.
To save myself, and a few others, some time in the future, here they are:
Include file :: /usr/include/asm-generic/errno-base.h
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H
@KatelynHaworth
KatelynHaworth / main.go
Last active August 9, 2024 02:08
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
@alexellis
alexellis / install-docker-master.sh
Last active August 31, 2023 21:52 — forked from BretFisher/copy-paste.txt
install docker engine for swarm3k on Ubuntu 16.04. 2 options for installing
#!/bin/sh
# option 2: paste this into user-data to automate install via boot script
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours
# renames the host to have a suffix of alexellisio
export original=$(cat /etc/hostname)
sudo hostname $original-master-alexellisio
echo $original-master-alexellisio | sudo tee /etc/hostname
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@mrkpatchaa
mrkpatchaa / README.md
Last active April 15, 2025 00:19
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@nadeemsyed
nadeemsyed / gist:c89d67fe5805788b7243
Created July 20, 2015 19:21
Create a sample shared library in golang 1.5.
nadeem@myznc:~/go/src$ ls -al dummy
total 12
drwxrwxr-x 2 nadeem nadeem 4096 Jul 20 18:46 .
drwxrwxr-x 6 nadeem nadeem 4096 Jul 20 18:45 ..
-rw-rw-r-- 1 nadeem nadeem 129 Jul 20 18:46 hello.go
nadeem@myznc:~/go/src/dummy$ cat hello.go
// Package dummy contains hello world library.
package dummy
@pbojinov
pbojinov / README.md
Last active April 28, 2025 15:25
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe