Skip to content

Instantly share code, notes, and snippets.

View zypA13510's full-sized avatar

Yuping Zuo zypA13510

  • China
  • 02:22 (UTC +08:00)
View GitHub Profile
@zypA13510
zypA13510 / compute-engine-ddns.service
Created December 26, 2021 19:48
Utility script to help GCP Compute Engine VMs to set their ephemeral IP address to Cloud DNS zone on boot.
[Unit]
Description=Update current instance IP to Cloud DNS.
After=network-online.target auditd.service
[Service]
#ExecStart=/opt/compute-engine-ddns.sh <zone-name> <domain>
Type=oneshot
[Install]
WantedBy=multi-user.target
@robm82
robm82 / intuneps-x64.ps1
Created October 5, 2020 16:01
Script to run Intune Win32 PowerShell scripts in 64-bit context
# Many thanks to Z-NERD for this, and this script is a copy of the one provided on his website
# Here is a link to the original script: https://z-nerd.com/blog/2020/03/31-intune-win32-apps-powershell-script-installer/
# This is here just in case the post gets removed/lost :)
$argsString = ""
If ($ENV:PROCESSOR_ARCHITEW6432 -eq "AMD64") {
Try {
foreach($k in $MyInvocation.BoundParameters.keys)
{
switch($MyInvocation.BoundParameters[$k].GetType().Name)
@a0n
a0n / upgrade_raspbian_to_buster.sh
Last active July 8, 2019 03:46 — forked from nickfox-taterli/upgrade_raspbian_to_buster.sh
Upgrade Raspbian To Buster
#!/bin/bash
sudo bash -c "sync \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade \
&& sed -i 's/stretch/buster/g' /etc/apt/sources.list \
&& sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/raspi.list \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade \
@zypA13510
zypA13510 / bootstrap-ms-standalone.css
Last active March 1, 2021 06:02 — forked from Jakobud/bootstrap-ms.scss
Adds in the missing 480px-768px breakpoint range to Bootstrap 3 for SASS
.col-xs-1, .col-ms-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-ms-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-ms-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-ms-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-ms-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-ms-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-ms-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-ms-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-ms-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-ms-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-ms-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-ms-12, .col-sm-12, .col-md-12, .col-lg-12 {
position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
}
@media (min-width: 480px) and (max-width: 767px) {
.container {
max-width: 748px;
@zypA13510
zypA13510 / recaptcha.conf
Last active April 15, 2024 08:07
How to set up a reverse proxy for Recaptcha on Apache httpd
LoadModule ssl_module modules/mod_ssl.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
<VirtualHost *:443>
ServerName yourdomain.com:443
SSLEngine On
SSLProxyEngine On
@jamesfreeman959
jamesfreeman959 / keepawake.ps1
Last active June 29, 2024 07:20
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
$wsh = New-Object -ComObject WScript.Shell
while (1) {
@kekru
kekru / add CA cert on CentOS Debian Ubuntu.md
Last active June 27, 2024 18:17
Add CA cert to local trust store on CentOS, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://thewebsite.org
@kacchan822
kacchan822 / softethervpn_letsencrypt_cert_autoupdate.sh
Last active July 3, 2024 01:26
softethervpn_letsencrypt_cert_autoupdate.sh
#!/bin/bash
#
# Copyright (c) 2016 Katsuya SAITO
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
# @(#) softethervpn_letsencrypt_cert_autoupdate.sh ver.0.1.0 2016.02.20
#
# Usage: softethervpn_letsencrypt_cert_autoupdate.sh CommonName WEBROOT PASSWORD MAIL
#
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active June 10, 2024 09:43
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@jcbozonier
jcbozonier / gist:1692807
Created January 28, 2012 05:17
Using a date reviver in JSON.parse
function dateReviver(key, value) {
if (typeof value === 'string') {
var a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6]));
}
}
return value;
};