Skip to content

Instantly share code, notes, and snippets.

View oakaigh's full-sized avatar
👻
* { color: black !important; }

Jared C oakaigh

👻
* { color: black !important; }
View GitHub Profile
@aromig
aromig / robocopy_exclude_existing_files.cmd
Created September 28, 2016 14:47
Robocopy - Exclude Existing Files
robocopy c:\Sourcepath c:\Destpath /E /XC /XN /XO
:: /E makes Robocopy recursively copy subdirectories, including empty ones.
:: /XC excludes existing files with the same timestamp, but different file sizes. Robocopy normally overwrites those.
:: /XN excludes existing files newer than the copy in the source directory. Robocopy normally overwrites those.
:: /XO excludes existing files older than the copy in the source directory. Robocopy normally overwrites those.
:: With the Changed, Older, and Newer classes excluded, Robocopy will exclude files existing in the destination directory.
@abn
abn / rpm-build-workflow.md
Last active May 18, 2022 05:04
RPM build and hosting workflow using github, travis-ci and copr

RPM Build Flow

This document details a simple RPM build flow pattern used to build and host RPM artifacts for open source projects. The below is a visual summary of this flow.

In order to achieve this multiple tools and services are used. The services and their purpose in the flow is as listed below.

Service Purpose
GitHub As is the most common use for GitHub, it holds the build source code. In this case we hold only the spec files and related source files. All other sources, including project binaries/sources are retrieved at build time.
@myfreeer
myfreeer / baidu.hosts
Created August 11, 2016 08:46
hosts aiming to fuck ads and malicious code by *.baidu.com
127.0.0.1  m1.baidu.com
127.0.0.1  mobads.baidu.com
127.0.0.1  mpro.baidu.com
127.0.0.1  mobads-logs.baidu.com
127.0.0.1  dl.client.baidu.com
127.0.0.1  a.baidu.com
127.0.0.1  wm.baidu.com
127.0.0.1  adm.baidu.com
127.0.0.1  baidutv.baidu.com
127.0.0.1  banlv.baidu.com
@gkoyuncu
gkoyuncu / pf_nat_reverse.c
Last active April 13, 2023 08:01
pf DIOCNATLOOK example - taken from spamd/grey.c
/* Stolen from ftp-proxy */
int
server_lookup(struct sockaddr *client, struct sockaddr *proxy,
struct sockaddr *server)
{
if (client->sa_family == AF_INET)
return (server_lookup4(satosin(client), satosin(proxy),
satosin(server)));
if (client->sa_family == AF_INET6)
@nerdroychan
nerdroychan / No Baidu
Last active December 17, 2020 03:00
A hosts file to block all .baidu.com domains.
##
# Block Baidu
##
127.0.0.1 baidu.com
127.0.0.1 www.baidu.com
127.0.0.1 pan.baidu.com
127.0.0.1 post-js.baidu.com
127.0.0.1 bbs.baidu.com
127.0.0.1 tieba.baidu.com
127.0.0.1 wapp.baidu.com
@dgoguerra
dgoguerra / script-with-options.sh
Last active November 10, 2024 20:00
Manual alternative to getopt in bash scripts, supporting short and long options
#!/usr/bin/env bash
# File name
readonly PROGNAME=$(basename $0)
# File name, without the extension
readonly PROGBASENAME=${PROGNAME%.*}
# File directory
readonly PROGDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Arguments
readonly ARGS="$@"
@pkuczynski
pkuczynski / LICENSE
Last active January 22, 2025 17:56
Read YAML file from Bash script
MIT License
Copyright (c) 2014 Piotr Kuczynski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAR
@javiermon
javiermon / LICENSE
Last active July 8, 2024 06:36
get default gateway
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
@baruch
baruch / libev_async_dns.c
Created May 5, 2013 19:02
Asynchronous dns resolving with libev and the gethostbyname_r function.
#include <ev.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <netdb.h>
#include <memory.h>
typedef struct net_client_t {
ev_signal resolv_watcher;
char hostname[64];
@OrangeTide
OrangeTide / showif.c
Created April 8, 2011 02:59
example to list network interfaces on linux/bsd/osx/etc
/* showif.c : PUBLIC DOMAIN - Jon Mayo - August 22, 2006
* - You may remove any comments you wish, modify this code any way you wish,
* and distribute any way you wish.*/
/* finds all network interfaces and shows a little information about them.
* some operating systems list interfaces multiple times because of different
* flags, modes, etc. if you want to use this code you should be aware that
* duplicate interfaces is a possibility */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>