Skip to content

Instantly share code, notes, and snippets.

View alazyer's full-sized avatar

Yuliang Zhang alazyer

  • Nanjing
View GitHub Profile
@alazyer
alazyer / shallow_update_git.md
Created June 15, 2022 01:37 — forked from gobinathm/shallow_update_git.md
Fix for Remote rejected shallow update not allowed after changing Git remote URL

Some Time there is a shallow update not allowed issue in your cloned GIT repo.

This means that you have to unshallow your repository. To do so you will need to add your old remote again.

git remote add origin <path-to-old-remote> After that we use git fetch to fetch the remaining history from the old remote (as suggested in this answer).

git fetch --unshallow origin And now you should be able to push into your new remote repository.

@alazyer
alazyer / filebeat.yml
Last active July 23, 2021 05:53
filebeat
‎‎​
#!/bin/sh
# https://github.com/bigswitch/deployment-support/blob/master/openstack/clean-devices.sh
set -e
for qvb in `ifconfig -a | grep qvb | cut -d' ' -f1`
do
`sudo ip link set $qvb down`
`sudo ip link delete $qvb`

Python Socket 编程详细介绍

Python 提供了两个基本的 socket 模块:

  • Socket 它提供了标准的BSD Socket API。
  • SocketServer 它提供了服务器重心,可以简化网络服务器的开发。

下面讲解下 Socket模块功能。

Socket 类型

@alazyer
alazyer / cloud_router_vnfd.yaml
Created June 26, 2017 09:32 — forked from Ladas/cloud_router_vnfd.yaml
Working NSD and VNFD
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: OPNFV-Demo-flavor
# NOT USED
#imports:
# - tacker_nfv_defs.yaml
# - tacker_defs.yaml
metadata:
var vv = window,
w = vv.innerWidth,
h = vv.innerHeight;
var svg = d3.select("#animviz")
.append("svg")
.attr("width", w)
.attr("height", h);
svg.append("g").attr("class", "links");
@alazyer
alazyer / forms.py
Last active August 29, 2015 14:06 — forked from maraujop/forms.py
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()
@alazyer
alazyer / gist:d2275d27b53cf115351b
Last active August 29, 2015 14:04
recreate database based on template database on postgresql
As the template database can't be deleted directly, so should change it into non-template database first;
$ psql -U postgres postgres
$ update pg_database set datistemplate='f' where datname='template_database';
$ drop database template_database;
create a database based on the defined template database;
$ createdb -T template_database newdatabase;
%% Read Netflix dataset
A = readSMAT('/scratch/dgleich/netflix/netflix.smat');
k = [10 25 50 100 150 200];
l = size(k,2);
%% Matlab's SVDS
for i= 1:l
tic;
[U,S,V] = svds(A,k(i));