Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#set -x
# Delete references to SVN branches that no longer exist
# Usage (this will not execute without asking you to confirm the list):
# bin/git-svn-prune.sh
# Started with
# Set your SVN prefix
@fengli320
fengli320 / using_git-svn.md
Created June 9, 2020 00:40 — forked from rickyah/using_git-svn.md
A simple guide to git-svn

#Getting started with git-svn

git-svn is a git command that allows using git to interact with Subversion repositories.git-svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation. SourceTree also happens to support this command so you can use it with your usual workflow.

Reference: http://git-scm.com/book/en/v1/Git-and-Other-Systems-Git-and-Subversion

##Cloning the SVN repository

You need to create a new local copy of the repository with the command

@fengli320
fengli320 / svn_workflow.sh
Created June 11, 2020 13:54 — forked from hendrauzia/svn_workflow.sh
SVN Workflow
# create working directory from trunk
svn checkout http://somedomain.com/repo/trunk
# create a branch
svn copy http://somedomain.com/repo/trunk \
http://somedomain.com/repo//branches/feature-do-awesome-thing \
-m "Created branch to implement feature do awesome thing."
# switch working copy
svn switch ^/repo/branches/feature-do-awesome-thing
@fengli320
fengli320 / gitlab-error-encryption.md
Created August 28, 2020 10:16 — forked from aursu/gitlab-error-encryption.md
GitLab error OpenSSL::Cipher::CipherError () in app/controllers/admin/application_settings_controller.rb:40:in `update'

The issue

It happened after secrets file was lost during GitLab upgrade.

The case described in documentation When the secrets file is lost

But not completely clear.

From log file /var/log/gitlab/gitlab-rails/production.log:

@fengli320
fengli320 / gitea-backup.sh
Created August 29, 2020 07:30 — forked from bst27/gitea-backup.sh
A Gitea backup script for Docker: It creates a .zip backup of Gitea running inside Docker and moves the backup file to the current working directory.
#!/bin/bash
# This script creates a .zip backup of gitea running inside docker and copies the backup file to the current working directory
echo "Creating gitea backup inside docker containter ..."
docker exec -u git -it -w /tmp $(docker ps -qf "name=gitea_server_1") bash -c '/app/gitea/gitea dump -c /data/gitea/conf/app.ini --file /tmp/gitea-dump.zip'
echo "Copying backup file from the container to the host machine ..."
docker cp $(docker ps -qf "name=gitea_server_1"):/tmp/gitea-dump.zip /tmp
@fengli320
fengli320 / CallerInfoAttibuteNet4.cs
Last active April 10, 2021 14:35 — forked from svick/CallerInfoAttibuteNet4.cs
How to use caller info attributes on .Net 4.0
// Visual Studio 2012 or above is required
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
public class CallerMemberNameAttribute : Attribute
{
}
@fengli320
fengli320 / async.cs
Created April 13, 2021 23:56 — forked from dgrunwald/async.cs
Async/Await support for .NET 4.0
// Copyright (c) 2012 Daniel Grunwald
//
// 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.
@fengli320
fengli320 / UnitTests.cs
Created April 21, 2021 00:30 — forked from StephenCleary/UnitTests.cs
How StartNew responds to CancellationToken
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class StartNewCancellationTokenUnitTests
{
[TestMethod]
public void CancellationTokenPassedToStartNew_CancelsTaskWithTaskCanceledException()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ctypes import *
from ctypes.wintypes import *
INVALID_HANDLE_VALUE = -1
CREATE_UNICODE_ENVIRONMENT = 0x00000400
async def main():
coroutine1 = do_some_work(1)
coroutine2 = do_some_work(2)
coroutine3 = do_some_work(4)
tasks = [
asyncio.ensure_future(coroutine1),
asyncio.ensure_future(coroutine2),
asyncio.ensure_future(coroutine3)
]