Skip to content

Instantly share code, notes, and snippets.

@upzone
upzone / 2repos-sync.sh
Created December 23, 2016 09:42 — forked from yorammi/2repos-sync.sh
Sync 2 remote repositories script - Just define the 3 variables (use export command for that!)
#!/bin/bash
# REPO_NAME=<repo>.git
# ORIGIN_URL=git@<host>:<project>/$REPO_NAME
# REPO1_URL=git@<host>:<project>/$REPO_NAME
rm -rf $REPO_NAME
git clone --bare $ORIGIN_URL
if [ "$?" != "0" ]; then
echo "ERROR: failed clone of $ORIGIN_URL"
@upzone
upzone / open-firewall-port-80-centos.sh
Created April 14, 2017 03:57 — forked from goyalmohit/open-firewall-port-80-centos.sh
Open firewall for port 80 on CentOS
#this command configure firewall to accept incoming tcp connections on port 80
firewall-cmd --zone=public --permanent --add-port=80/tcp
firewall-cmd --reload
@upzone
upzone / index.html
Created May 2, 2017 09:35 — forked from triceam/index.html
JavaScript Templating Example to show rendering techniques of JS data in HTML or XML formats.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>JSON Transform</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
<script type="text/javascript" src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js"></script>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet"></link>
@upzone
upzone / getter_and_setter.py
Created May 31, 2017 06:33 — forked from luhn/getter_and_setter.py
Using getters and setters with SQLAlchemy
class Table(Base):
id = Column(Integer, primary_key=True)
_name = Column('name', String(24))
@property
def name(self):
return self._name;
@name.setter
def name(self, value):
@upzone
upzone / DoSWFUnpacker.java
Created September 21, 2017 09:05 — forked from lvdaqian/DoSWFUnpacker.java
Unpack flash file that was encrypted by DoSWF
package org.ddth.game;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@upzone
upzone / SPOUpload-Files.ps1
Created December 12, 2017 04:44 — forked from vgrem/SPOUpload-Files.ps1
Upload files into Document Library in SharePoint Online
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Function Ensure-Folder()
{
Param(
[Parameter(Mandatory=$True)]
[Microsoft.SharePoint.Client.Web]$Web,

Install x264

cd ~
git clone git://git.videolan.org/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make -j4
sudo make install
@upzone
upzone / cmdline-publish
Created December 29, 2018 17:54 — forked from tdavisjr/cmdline-publish
msbuild command line publish
VS2012+ have these featured built in
msbuild ProjectFile.csproj /p:Configuration=Release ^
/p:Platform=AnyCPU ^
/t:WebPublish ^
/p:WebPublishMethod=FileSystem ^
/p:DeleteExistingFiles=True ^
/p:publishUrl=c:\output
Or if you are building the solution file:
COMPILING VISUAL STUDIO CODE ON A RASPBERRY PI 3
From the VS Code GitHub, you need Node, npm, and Python. The Pi has Python but it has an old node, so needed a newer node that ran on ARM processors.
get http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
There are some NPM native modules like node-native-keymap that didn't work when I built the first time, so you'll need some supporting libraries first:
sudo apt-get install libx11-dev
@upzone
upzone / samba
Created December 30, 2018 05:01
1. 修改samba密码
注意samba有独立密码,不是linux用户密码
sudo smbpasswd pi
然后输入两次新密码
2. 修改samba共享目录,增加新的共享目录
/etc/samba/smb.conf
[media]